<!-- Start of mainbody -->
    <div class="mainbody">
        <ul class="tabs">
            <li <?php if(!$type) echo 'class="activetab"'  ?>><a href="<?php echo $html->url('/events') ?>">All Events</a></li>
            <li <?php if($type=="Social") echo 'class="activetab"'  ?>><a href="<?php echo $html->url('/events/'.date('Y-m').'/Social') ?>">Social Calendar</a></li>
            <li <?php if($type=="Boating") echo 'class="activetab"'  ?>><a href="<?php echo $html->url('/events/'.date('Y-m').'/Boating') ?>">Boating Trips</a></li>
            <li <?php if($type=="Speaker") echo 'class="activetab"'  ?>><a href="<?php echo $html->url('/events/'.date('Y-m').'/Speaker') ?>">Speakers</a></li>
            <li <?php if($type=="Course") echo 'class="activetab"'  ?>><a href="<?php echo $html->url('/events/'.date('Y-m').'/Course') ?>">Course Schedule</a></li>
        </ul>
        <div class="calendar">
            <dl class="tabscon">
                <dd class="tabItem line">
                    <div class="leftbar">
                        <?php 
                        
                        
                        $calender=$jCalender->getCalArr($time);
                        
                        if($time){
                            $curmonth=date('m',$time);
                            $thismonth=date('F',$time);
                            $thisyear=date('Y',$time);
                        }
                        else {
                            $curmonth=date('m');
                            $thismonth=date('F');
                            $thisyear=date('Y');
                        }
                        
                        $nextCal=date('Y-m',strtotime('+1 day',$jCalender->getEnd($time)));
                        $prevCal=date('Y-m',strtotime('-1 day',$jCalender->getStart($time)));
                        
                        ?>
                        <div class="mb20"> <?php
    
                        
                        $events_calender='
    
    
                            <span class="calenderNav">
                                <a href="'.$html->url('/events/'.$prevCal.($type?'/'.$type:'')).'" style="float:left" >'.$html->image('cleft.gif').'</a>
                                '.$thismonth.' '.$thisyear.'
                                <a href="'.$html->url('/events/'.$nextCal.($type?'/'.$type:'')).'" style="float:right" >'.$html->image('cright.gif').'</a>
                            </span>
                            
                            <table class="events"><tr>';
                         
                            $first='rel="first"';
                                foreach($jCalender->weekDays as $day=>$val){
                                    $events_calender.="<th $first>".substr($day,0,1)."</th>";
                                    $first='';
                                }
                                            
                                            
                                            $list=array();
                                            
                            $events_calender.='</tr>';
                                        
                                            foreach($calender as $row){
                                                $events_calender.='<tr>';
                                                $first='rel="first"';
                                                foreach($row as $day){
                                                    $this_days_events='';
                                                    
                                                    $events_calender.="<td $first ".($jCalender->d($day,'m')!=$curmonth?'class="notthis"':'').">
                                                    
                                                    <a href='".$html->url('/events/'.$jCalender->d($day)).($type?'/'.$type:'')."' >".$jCalender->d($day,'j')."</a>
                                                    
                                                    
                                                    
                                                                
                                                
                                                                            </td>";
                                                    $first='';
                                                }
                                                $events_calender.='</tr>';
                                            }
                
              
                
                                      $events_calender.="</table>
                                      
                                      ";
                                      
                                      
                                      echo $events_calender;
                            
                        ?>    
                        </div>
                        
                        <div class="infoHolder">
                        </div>
                    </div>
                    <div class="mainarea">
                        <div class="schedule">
                        <?php if(count($events)):?>
                        <dl>
                            <?php foreach($events as $key=>$date):?>
                            <dt><?php echo date('l, F j, Y',strtotime($key))?></dt>
                                <?php foreach($date as $item):?>
                                <dd><span class="<?php echo strtolower($item['type'])?>"><em><?php echo $item['type']?></em></span> <?php echo ($item['event_time']?'- '.$item['event_time']:'')?> <?php echo ($item['title']?'- '.$item['title']:'')?>
                                    <div class="hideInfo">
                                        <ul class="infolist">
                                            <?php echo ($item['title']?"<li><strong>Title:</strong> $item[title] </li>":'')?>
                                            <?php echo ($item['event_date']?"<li><strong>Date:</strong> $item[event_date] </li>":'')?>
                                            <?php echo ($item['type']?"<li><strong>Type:</strong> $item[type] </li>":'')?>
                                            <?php echo ($item['event_time']?"<li><strong>Time:</strong> $item[event_time] </li>":'')?>
                                            <?php echo ($item['notes']?"<li><strong>Notes:</strong> $item[notes] </li>":'')?>
                                            
                                            <!--<li><strong>Date:</strong> 11/07/2010</li>
                                            <li><strong>Type:</strong> Course</li>
                                            <li><strong>Time:</strong> 2:00pm</li>
                                            <li><strong>Instructor:</strong>P/D/Lt/C Michael J. Kovalcin, SN </li>
                                            <li><strong>Notes:</strong> n/a</li>-->
                                        </ul>
                                    </div>
                                </dd>
                                <?php endforeach?>
                            
                            <?php endforeach?>
                            
                            
                        </dl>
                        <script type="text/javascript">
                            $(document).ready(function(){
                                $('.schedule dd').click(function(){
                                    $('.infoHolder').html($(this).find('.hideInfo').html())
                                })
                            })
                        </script>
                        
                        <?php else:?>
                        <dl>
                            <dt>
                                There are no events on this <?php echo $eventview?>.
                            </dt>
                        </dl>
                        <?php endif?>
                        </div>
                    </div>
                </dd>
                <!--<dd class="tabItem">Social Calendar</dd>
                <dd class="tabItem">Boating Trips</dd>
                <dd class="tabItem">Speakers</dd>
                <dd class="tabItem">Course Schedule</dd>-->
            </dl>
        </div>            
    </div>
    <!-- End of mainbody -->